// import 'dart:async';
//
// import 'package:flutter/services.dart';
//
// class Uikit {
//   static const MethodChannel _channel = MethodChannel('uikit');
//
//   static Future<String?> get platformVersion async {
//     final String? version = await _channel.invokeMethod('getPlatformVersion');
//     return version;
//   }
// }

import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
import 'package:uikit/theme/riki_base_theme.dart';
import 'package:uikit/theme/riki_theme.dart';
import 'package:uikit/utils/screen_util/screenutil_init.dart';

//export 'package:flutter_cache_manager/flutter_cache_manager.dart';
//export 'package:fluttertoast/fluttertoast.dart';
// export 'package:provider/provider.dart';

export 'http/core/hi_net_error.dart';
export 'http/dao/login_dao.dart';
export 'theme/riki_theme.dart';
export 'utils/image_util/image_util.dart';
export 'utils/sp_util.dart';
export 'utils/text_util.dart';

class RikiUikit {
  static const String PACKAGE = 'uikit';

  static bool isDebug = false;

  static late BuildContext _context;

  static BuildContext get context => _context;

  static Widget init({
    required BuildContext context,
    required Widget Function(BuildContext context, RikiBaseTheme theme) builder,
    Size designSize = const Size(375, 667),
    ToastPosition toastPosition = const ToastPosition(align: Alignment.center),
    ScrollBehavior? behavior,
  }) {
    _context = context;
    return ScreenUtilInit(
      builder: () {
        return OKToast(
          position: toastPosition,
          child: builder(context, RikiTheme.of(context)),
        );
      },
      designSize: designSize,
    );
  }
}
